var t = require("../common/index.js");
var app = getApp()
Component({
  properties: {
    data: {
      type: Object
    },
    floorIndex: {
      type: Number
    },
    currentTab: {
      type: Number
    },
  },
  methods: {
    goTbLink: function (e) {
      console.log('tbProduct goLink',e)
      var o = e.currentTarget.dataset, i = o.item, a = i.item_id, r = o.positionIndex, s = o.timestamp, d = e.currentTarget.offsetTop;
      if (a) {
        var p = this.data.floorIndex;
        t.goLink({
          type: "tb_goods",
          data: { item : i },
          saOption: {
            componentName: "tbProduct",
            floorIndex: p,
            positionIndex: r,
            timestamp: s,
            offsetTop: d
          }
        });
      }
    },
    goNormalLink: function (e) {
      var o = e.currentTarget.dataset, i = o.item, a = i.id, r = o.positionIndex, s = o.timestamp, d = e.currentTarget.offsetTop;
      if (a) {
        var p = this.data.floorIndex;
        (0, t.goLink)({
          type: "goods",
          data: { item : i },
          saOption: {
            componentName: "goodsList",
            floorIndex: p,
            positionIndex: r,
            timestamp: s,
            offsetTop: d
          }
        });
      }
    },
    goMore(e){
      console.log('goMore',e)
      this.triggerEvent('more',e);
    },
    handleChange({ detail }){
      console.log('detail.index',detail.index)
      console.log('this.data.data.productIds',this.data.data);
      var typeId = this.data.data.productTypeIds[detail.index];
      detail["typeId"] = typeId;
      detail["floorIndex"] = this.data.floorIndex;
      this.triggerEvent('change',detail);
    }
  }
});